<!DOCTYPE html>
<html ng-app="demoApp">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>确认对话框 - ng-components-ui</title>
    <link rel="stylesheet" href="../dist/ng-components.css" />
    <style>
      * {
        box-sizing: border-box;
      }

      body {
        font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
          "Helvetica Neue", Arial, sans-serif;
        margin: 0;
        padding: 0;
        background: #f5f5f5;
      }

      .header {
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        color: white;
        padding: 30px 40px;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
      }

      .header h1 {
        margin: 0 0 10px 0;
        font-size: 32px;
      }

      .header p {
        margin: 0;
        opacity: 0.9;
        font-size: 16px;
      }

      .back-link {
        display: inline-block;
        margin-top: 15px;
        color: white;
        text-decoration: none;
        padding: 8px 16px;
        background: rgba(255, 255, 255, 0.2);
        border-radius: 4px;
        transition: background 0.2s;
      }

      .back-link:hover {
        background: rgba(255, 255, 255, 0.3);
      }

      .container {
        max-width: 1400px;
        margin: 0 auto;
        padding: 40px;
      }

      .demo-section {
        background: white;
        padding: 30px;
        border-radius: 8px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
        margin-bottom: 30px;
      }

      .demo-section h2 {
        margin: 0 0 20px 0;
        color: #333;
        font-size: 20px;
        border-bottom: 2px solid #667eea;
        padding-bottom: 10px;
      }

      .demo-section h3 {
        margin: 20px 0 15px 0;
        color: #555;
        font-size: 16px;
        font-weight: 600;
      }

      .demo-section p {
        color: #666;
        line-height: 1.6;
        margin: 0 0 15px 0;
      }

      .demo-actions {
        display: flex;
        gap: 15px;
        flex-wrap: wrap;
        margin: 20px 0;
      }

      .btn {
        padding: 10px 20px;
        border: none;
        border-radius: 6px;
        cursor: pointer;
        font-size: 14px;
        font-weight: 500;
        transition: all 0.2s;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
      }

      .btn:hover {
        transform: translateY(-2px);
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
      }

      .btn:active {
        transform: translateY(0);
      }

      .btn-primary {
        background: #667eea;
        color: white;
      }

      .btn-primary:hover {
        background: #5568d3;
      }

      .btn-success {
        background: #48bb78;
        color: white;
      }

      .btn-success:hover {
        background: #38a169;
      }

      .btn-warning {
        background: #ed8936;
        color: white;
      }

      .btn-warning:hover {
        background: #dd6b20;
      }

      .btn-danger {
        background: #f56565;
        color: white;
      }

      .btn-danger:hover {
        background: #e53e3e;
      }

      .btn-info {
        background: #4299e1;
        color: white;
      }

      .btn-info:hover {
        background: #3182ce;
      }

      .code-block {
        background: #f7fafc;
        border: 1px solid #e2e8f0;
        border-radius: 4px;
        padding: 15px;
        margin: 10px 0;
        font-family: "Monaco", "Menlo", "Ubuntu Mono", monospace;
        font-size: 12px;
        overflow-x: auto;
      }

      .code-block code {
        color: #2d3748;
      }

      .feature-list {
        background: #f7fafc;
        border-left: 4px solid #667eea;
        padding: 15px 20px;
        margin: 20px 0;
      }

      .feature-list ul {
        margin: 0;
        padding-left: 20px;
      }

      .feature-list li {
        color: #4a5568;
        margin: 8px 0;
        line-height: 1.6;
      }
    </style>
  </head>
  <body ng-controller="DemoController">
    <div class="header">
      <h1>确认对话框组件</h1>
      <p>支持多种类型的确认对话框，带动画效果</p>
      <a href="home.html" class="back-link">← 返回主页</a>
    </div>

    <div class="container">
      <div class="demo-section">
        <h2>确认对话框组件</h2>

        <div class="feature-list">
          <strong>功能特性:</strong>
          <ul>
            <li>支持多种对话框类型（信息、成功、警告、危险）</li>
            <li>自定义标题和内容</li>
            <li>可配置按钮文本和回调</li>
            <li>支持HTML内容</li>
            <li>优雅的动画效果</li>
          </ul>
        </div>

        <h3>使用示例</h3>
        <div class="demo-actions">
          <button class="btn btn-primary" ng-click="showInfo()">
            信息对话框
          </button>
          <button class="btn btn-success" ng-click="showSuccess()">
            成功对话框
          </button>
          <button class="btn btn-warning" ng-click="showWarning()">
            警告对话框
          </button>
          <button class="btn btn-danger" ng-click="showDanger()">
            危险对话框
          </button>
          <button class="btn btn-info" ng-click="showCustom()">
            自定义对话框
          </button>
        </div>

        <div class="code-block">
          <code>
// 基本用法<br>
$confirm.show({<br>
&nbsp;&nbsp;title: '确认操作',<br>
&nbsp;&nbsp;content: '您确定要执行此操作吗？',<br>
&nbsp;&nbsp;type: 'warning',<br>
&nbsp;&nbsp;okText: '确定',<br>
&nbsp;&nbsp;cancelText: '取消'<br>
}).then(function() {<br>
&nbsp;&nbsp;// 用户点击确定<br>
}, function() {<br>
&nbsp;&nbsp;// 用户点击取消<br>
});
          </code>
        </div>
      </div>
    </div>

    <script src="https://cdn.jsdelivr.net/npm/angular@1.8.3/angular.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/angular-strap@2.3.12/dist/angular-strap.min.js"></script>
    <script src="../dist/ng-components.js"></script>
    <script>
      angular
        .module("demoApp", ["ngComponents"])
        .controller("DemoController", function ($scope, $confirm) {
          $scope.showInfo = function () {
            $confirm
              .show({
                title: "信息提示",
                content: "这是一个信息提示对话框",
                type: "info",
                okText: "知道了",
                cancelText: "取消"
              })
              .then(
                function () {
                  console.log("用户点击了确定");
                },
                function () {
                  console.log("用户点击了取消");
                }
              );
          };

          $scope.showSuccess = function () {
            $confirm
              .show({
                title: "操作成功",
                content: "您的操作已成功完成！",
                type: "success",
                okText: "太好了",
                cancelText: "关闭"
              })
              .then(
                function () {
                  console.log("用户点击了确定");
                },
                function () {
                  console.log("用户点击了取消");
                }
              );
          };

          $scope.showWarning = function () {
            $confirm
              .show({
                title: "警告",
                content: "此操作可能会有风险，请谨慎操作",
                type: "warning",
                okText: "继续",
                cancelText: "取消"
              })
              .then(
                function () {
                  console.log("用户选择继续");
                },
                function () {
                  console.log("用户选择取消");
                }
              );
          };

          $scope.showDanger = function () {
            $confirm
              .show({
                title: "危险操作",
                content: "此操作不可恢复，确定要删除吗？",
                type: "danger",
                okText: "确定删除",
                cancelText: "我再想想"
              })
              .then(
                function () {
                  console.log("用户确认删除");
                },
                function () {
                  console.log("用户取消删除");
                }
              );
          };

          $scope.showCustom = function () {
            $confirm
              .show({
                title: "自定义对话框",
                content:
                  '<p>支持 <strong>HTML</strong> 内容</p><ul><li>列表项1</li><li>列表项2</li></ul>',
                type: "info",
                okText: "接受",
                cancelText: "拒绝"
              })
              .then(
                function () {
                  console.log("用户点击接受");
                },
                function () {
                  console.log("用户点击拒绝");
                }
              );
          };
        });
    </script>
  </body>
</html>
